package cn.cvs.servlet;

import cn.cvs.pojo.Card;
import cn.cvs.service.CardService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/DetailsServlet")
public class DetailsServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        CardService cardService = new CardService();
        String idNumber = request.getParameter("idNumber");
        Card card = cardService.details(idNumber);
        request.setAttribute("card",card);
        request.getRequestDispatcher("details.jsp").forward(request,response);
    }
}
